use async_trait::async_trait;
use serde::{Deserialize, Serialize};

/// 转换请求
#[derive(Debug, Deserialize, Serialize)]
pub struct ConversionRequest {
    pub data_source_type: String,
    pub connection_string: String,
    pub target_domain: String,  // 生产制造、机器人应用等
    pub mapping_rules: Option<serde_json::Value>,
}

/// 转换结果
#[derive(Debug, Serialize)]
pub struct ConversionResult {
    pub success: bool,
    pub model: OPCUAModel,
    pub statistics: ConversionStats,
    pub warnings: Vec<String>,
}

/// OPC UA 模型定义
#[derive(Debug, Serialize, Clone)]
pub struct OPCUAModel {
    pub name: String,
    pub namespace_uri: String,
    pub nodes: Vec<OPCUANode>,
    pub references: Vec<Reference>,
}

/// 语义转换器核心 trait
#[async_trait]
pub trait SemanticConverter: Send + Sync {
    async fn convert(&self, request: &ConversionRequest) -> Result<ConversionResult>;
    
    async fn validate_model(&self, model: &OPCUAModel) -> Result<ValidationResult>;
    
    fn get_supported_domains(&self) -> Vec<String>;
}